#include<stdio.h>

int main() {
    int arr[5][5] = {0};
    int n, m;

    for (int i = 0; i < 5; i++) {
        for (int j = 0; j < 5; j++) {
            scanf("%d", &arr[i][j]);
        }
    }

    scanf("%d %d", &n, &m);

    if (n < 0 || n > 4 || m < 0 || m > 4) {
        printf("error\n");
    } else {
        int temp;
        for (int i = 0; i < 5; i++) {
            temp = arr[n][i];
            arr[n][i] = arr[m][i];
            arr[m][i] = temp;
        }

        for (int i = 0; i < 5; i++) {
            for (int j = 0; j < 5; j++) {
                printf("%4d", arr[i][j]);  
            }
            printf("\n");
        }
    }

    return 0;
}
#include<stdio.h>

int main() {
    int arr[5][5] = {0};
    int n, m;

    for (int i = 0; i < 5; i++) {
        for (int j = 0; j < 5; j++) {
            scanf("%d", &arr[i][j]);
        }
    }

    scanf("%d %d", &n, &m);

    if (n < 0 || n > 4 || m < 0 || m > 4) 
    {
        printf("error\n");
    } else 
    {
        int temp;
        for (int i = 0; i < 5; i++) 
        {
            temp = arr[n][i];
            arr[n][i] = arr[m][i];
            arr[m][i] = temp;
        }

        for (int i = 0; i < 5; i++) 
        {
            for (int j = 0; j < 5; j++) {
                printf("%4d", arr[i][j]);  
            }
            printf("\n");
        }
    }

    return 0;
}
